#include "transport/iox/iox_proxy.h"

namespace motovis {
namespace transport {

IoxProxy::IoxProxy() 
{
    auto sz = std::to_string(getpid());
    strcpy(app_name_, sz.c_str());
    iox::runtime::PoshRuntime::initRuntime(app_name_);
    thread_ = std::make_shared<std::thread>(std::bind(&IoxProxy::exec, this));
}

IoxProxy::~IoxProxy()
{
    thread_->join();
}

void IoxProxy::exec()
{
    // iox::runtime::PoshRuntime::initRuntime(app_name_);
    while (!iox::posix::hasTerminationRequested())
    {
        std::this_thread::sleep_for(std::chrono::seconds(1));
    }
}

} // namespace transport
} // namespace motovis